
//boom light 用于上面第二种方法
export function createLight(x, y, every_angle, index, paint) {
    let light_len = 1074;
    let light_left_angle = Math.PI * (index * every_angle - 2.5) / 180;
    let light_right_angle = Math.PI * (index * every_angle + 2.5) / 180;
    let light_left_x = x + light_len * Math.cos(light_left_angle);
    let light_left_y = y + light_len * Math.sin(light_left_angle);
    let light_right_x = x + light_len * Math.cos(light_right_angle);
    let light_right_y = y + light_len * Math.sin(light_right_angle);

    let g = paint.getComponent(cc.Graphics);
    g.moveTo(x, y);
    g.lineTo(light_left_x, light_left_y);
    g.lineTo(light_right_x, light_right_y);
    g.close();
    g.stroke();
    g.fillColor = cc.Color.WHITE;
    g.fill();

}